<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    li {
        list-style: none;
        display: inline;
    }
    .active{
        color:red
    }
</style>

<body>
    <div id="app">
        电影列表
        <ul>
            <li v-for="(movie,index) in movies" :class='{active:actived==index}' @click="liClick(index)" style="margin-right: 20px;">{{movie}}</li>
        </ul>
    </div>
</body>
<script src="../js/http_cdn.bootcdn.net_ajax_libs_vue_2.6.6_vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            actived: 0,
            movies: ['海贼王', '火影忍者', '大话西游', '虎牙直播']
        },
        methods: {
            liClick: function (index) {
                this.actived = index
            }
        }
    })
</script>

</html>
